<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<title></title>
		<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
		<meta name="ProgId" content="VisualStudio.HTML">
		<meta name="Originator" content="Microsoft Visual Studio .NET 7.1">
	</head>
	<body>
		<TABLE id="Table1" cellSpacing="0" cellPadding="5" border="1">
			<CAPTION>
				<B>iTunesSD header format</B>
			</CAPTION>
			<TR>
				<TH>
					field
				</TH>
				<TH>
					size
				</TH>
				<TH>
					value
				</TH>
			</TR>
			<TR>
				<TD>num songs
				</TD>
				<TD>3
				</TD>
				<TD>Number of song entries in the file.
				</TD>
			</TR>
			<TR>
				<TD>unknown
				</TD>
				<TD>3
				</TD>
				<TD>0x010600?
				</TD>
			</TR>
			<TR>
				<TD>header size
				</TD>
				<TD>3
				</TD>
				<TD>size of the header (0x12, 18 byte header)
				</TD>
			</TR>
			<TR>
				<TD>unknown
				</TD>
				<TD>9
				</TD>
				<TD>possibly zero padding
				</TD>
			</TR>
			<TR>
				<TD colSpan="3">rest of header is NOT zero padded
				</TD>
			</TR>
		</TABLE>
		<TABLE id="Table2" cellSpacing="0" cellPadding="5" border="1">
			<CAPTION>
				<B>iTunesSD song entry format</B>
			</CAPTION>
			<TR>
				<TH>
					field
				</TH>
				<TH>
					size
				</TH>
				<TH>
					value
				</TH>
			</TR>
			<TR>
				<TD>size of entry
				</TD>
				<TD>3
				</TD>
				<TD>Always 0x22e (558 bytes)
				</TD>
			</TR>
			<TR>
				<TD>unk1
				</TD>
				<TD>3
				</TD>
				<TD>unknown (always 0x5aa501&nbsp;?)
				</TD>
			</TR>
			<TR>
				<TD>starttime
				</TD>
				<TD>3
				</TD>
				<TD>Start Time, in 256 millisecond increments - e.g. 60 seconds = 0xea (234 dec). 
					The reason for this is that the iPodShuffle has only a simplistic "clock". 
					Every millisecond it increments an 8 bit counter. When the counter overflows, 
					this causes an interrupt or something like that which causes it to increment 
					this "clock" value. Very simple clock, easy to do in a an 8-bit register. 
					Basically multiply whatever value you find here by 0.256 to convert it to 
					seconds. Leaving this as zero means it plays from the beginning of the file.
				</TD>
			</TR>
			<TR>
				<TD>unk2
				</TD>
				<TD>3
				</TD>
				<TD>unknown (always 0?)
				</TD>
			</TR>
			<TR>
				<TD>unk3
				</TD>
				<TD>3
				</TD>
				<TD>Unknown, but seems to be associated with start time (start time of 0xea 
					resulted in unk3 = 0x1258ee)
				</TD>
			</TR>
			<TR>
				<TD>stoptime
				</TD>
				<TD>3
				</TD>
				<TD>Stop Time, also in 256 millisecond increments - e.g. 120 seconds = 0x1d4 (468 
					dec). Leaving this as zero means it'll play to the end of the file.
				</TD>
			</TR>
			<TR>
				<TD>unk4
				</TD>
				<TD>3
				</TD>
				<TD>unknown
				</TD>
			</TR>
			<TR>
				<TD>unk5
				</TD>
				<TD>3
				</TD>
				<TD>Unknown, but seems to be associated with stop time (stop time of 0x1d4 resulted 
					in unk5 = 0x24a830)
				</TD>
			</TR>
			<TR>
				<TD>volume
				</TD>
				<TD>3
				</TD>
				<TD>Volume - ranges from 0x00 (-100%) to 0x64 (0%) to 0xc8 (100%)
				</TD>
			</TR>
			<TR>
				<TD>file_type
				</TD>
				<TD>3
				</TD>
				<TD>0x01 = MP3, 0x02 = AAC, 0x04 = WAV
				</TD>
			</TR>
			<TR>
				<TD>unk6
				</TD>
				<TD>3
				</TD>
				<TD>0x200?
				</TD>
			</TR>
			<TR>
				<TD>filename
				</TD>
				<TD>522
				</TD>
				<TD>filename of the song, padded at the end with 0's. Note: forward slashs are used 
					here, not colons like in the iTunesDB - for example 
					"/iPod_Control/Music/F00/Song.mp3".
				</TD>
			</TR>
			<TR>
				<TD>shuffleflag
				</TD>
				<TD>1
				</TD>
				<TD>If this value is 0x00, the song will be skipped in while the player is in 
					shuffle mode. Any other value (iTunes uses 0x01) will allow it be played in 
					both normal and shuffle modes. By default, iTunes 4.7.1 sets this flag to 0x00 
					for audiobooks (.m4b and .aa), so they aren't played in shuffle mode.
				</TD>
			</TR>
			<TR>
				<TD>bookmarkflag
				</TD>
				<TD>1
				</TD>
				<TD>If this value is 0x00, the song will not be bookmarkable (i.e. its playback 
					position won't be saved when switching to a different song). Any other value 
					will make it bookmarkable. Unlike hard drive based iPods, all songs can be 
					marked as bookmarkable - not just .m4b and .aa. However, iTunes might not use 
					this bookmark information for songs other than actual audiobooks. By default, 
					iTunes 4.7.1 sets this flag to 0x01 for audiobooks (.m4b and .aa), and 0x00 for 
					everything else.
				</TD>
			</TR>
			<TR>
				<TD>unknownflag
				</TD>
				<TD>1
				</TD>
				<TD>This has never been observed to be anything other than 0x00, and setting it 
					other values seemed to no effect.
				</TD>
			</TR>
		</TABLE>
		<P><A href="#iTunesSD_file">http://www.ipodlinux.org/ITunesDB#iTunesSD_file</A></P>
	</body>
</html>
